/* 懒加载(Suspense, lazy) 一定要在16.6以后的版本才可以使用
import { lazy } from 'react'
const App = lazy(() => import('@/App'))
import React, { Suspense } from 'react';
import { Spin } from 'antd';
<Route key={path} path={path}>
  <Suspense fallback={<Spin
    tip="Loading"
    size="large"
    delay={500} />}>
    <Com />
  </Suspense>
</Route>*/
import {
  FolderOpenOutlined, SortAscendingOutlined,
  // FireOutlined,
  FileAddOutlined, FileZipOutlined, HeartOutlined,
  NotificationOutlined, FlagOutlined,
  UserOutlined, ToolOutlined
} from '@ant-design/icons';
import React from 'react'//支持jsx语法
import Loadable from 'react-loadable'
import { Spin } from 'antd';

// 一级
const App = Loadable({
  loader: () => import('@/App'),
  loading: () => <Spin />
})
const Login = Loadable({
  loader: () => import('@/views/login-register/Login'),
  loading: () => <Spin />
})
const Register = Loadable({
  loader: () => import('@/views/login-register/Register'),
  loading: () => <Spin />
})
const NotFound = Loadable({
  loader: () => import('@/views/notfound'),
  loading: () => <Spin />
})

// 二级
const All = Loadable({
  loader: () => import('@/components/blog/all'),
  loading: () => <Spin />
})
const BlogCategory = Loadable({
  loader: () => import('@/components/blog/category'),
  loading: () => <Spin />
})
// import BlogHigh from '@/components/blog/high-quality'
const BlogDetails = Loadable({
  loader: () => import('@/components/blog/details'),
  loading: () => <Spin />
})

const PubCreate = Loadable({
  loader: () => import('@/components/pub/create'),
  loading: () => <Spin />
})
const PubArticles = Loadable({
  loader: () => import('@/components/pub/articles'),
  loading: () => <Spin />
})
const PubCollect = Loadable({
  loader: () => import('@/components/pub/collect'),
  loading: () => <Spin />
})

const SupportAbout = Loadable({
  loader: () => import('@/components/support/about'),
  loading: () => <Spin />
})
const SupportJoin = Loadable({
  loader: () => import('@/components/support/join'),
  loading: () => <Spin />
})

const UserMine = Loadable({
  loader: () => import('@/components/user/mine'),
  loading: () => <Spin />
})
const UserModify = Loadable({
  loader: () => import('@/components/user/modify'),
  loading: () => <Spin />
})

const Test = Loadable({
  loader: () => import('@/components/test'),
  loading: () => <Spin />
})


export const routes = [
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/notfound',
    component: NotFound
  },
  {
    path: '/blog',
    component: App
  },
  {
    path: '/pub',
    component: App
  },
  {
    path: '/questions',
    component: App
  },
  {
    path: '/support',
    component: App
  },
  {
    path: '/user',
    component: App
  },
  {
    path: '/test',
    component: Test
  }
]

export const a = [

  // {
  //   path: '/home/skill',
  //   name: '运用技术',
  //   icon: 'SwapRightOutlined',
  //   component: Skill
  // },
  // {
  //   path: '/home/about',

  //   name: '关于本站',
  //   icon: 'SwapRightOutlined',
  //   component: About
  // },
  // {
  //   path: '/home/',
  //   name: '今日热点',
  //   icon: 'SwapRightOutlined',
  //   component: Hot
  // }
]

export const subRoutes = [
  {
    path: '/blog',
    name: '博客',
    children: [
      {
        path: '/blog',
        name: '所有博客',
        icon: FolderOpenOutlined,
        component: All,
        exact: true
      },
      // {
      //   path: '/blog/high-quality',
      //   name: '精品博客',
      //   icon: FireOutlined,
      //   component: BlogHigh
      // },
      {
        path: '/blog/category',
        name: '搜索博客',
        icon: SortAscendingOutlined,
        component: BlogCategory
      },

      {
        path: '/blog/details/:id',
        name: '博客详情',
        component: BlogDetails
      },
    ]
  },
  {
    path: '/pub',
    name: '发布文章',
    children: [
      {
        path: '/pub',
        name: '发布文章',
        icon: FileAddOutlined,
        component: PubCreate,
        exact: true
      },
      {
        path: '/pub/articles',
        name: '文章管理',
        icon: FileZipOutlined,
        component: PubArticles
      },
      {
        path: '/pub/collect',
        name: '我的收藏',
        icon: HeartOutlined,
        component: PubCollect
      }
    ]
  },
  {
    path: '/support',
    name: '关于我们',
    children: [
      {
        path: '/support',
        name: '简介',
        icon: NotificationOutlined,
        component: SupportAbout,
        exact: true
      },
      {
        path: '/support/join',
        name: 'JOIN',
        icon: FlagOutlined,
        component: SupportJoin
      },

    ]
  },
  {
    path: '/user',
    name: '个人信息',
    children: [
      {
        path: '/user',
        name: '个人信息',
        icon: UserOutlined,
        component: UserMine,
        exact: true
      },
      {
        path: '/user/modify',
        name: '修改密码',
        icon: ToolOutlined,
        component: UserModify
      }
    ]
  },

]